package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.CgzxChkbillMesT;
import com.ruoyi.system.service.ICgzxChkbillMesTService;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 专检任务结果(城轨轴箱) 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-02-22
 */
@Controller
@RequestMapping("/system/cgzxChkbillMesT")
public class CgzxChkbillMesTController extends BaseController
{
    private String prefix = "system/cgzxChkbillMesT";
	
	@Autowired
	private ICgzxChkbillMesTService cgzxChkbillMesTService;
	
	@RequiresPermissions("system:cgzxChkbillMesT:view")
	@GetMapping()
	public String cgzxChkbillMesT()
	{
	    return prefix + "/cgzxChkbillMesT";
	}
	
	/**
	 * 查询专检任务结果(城轨轴箱)列表
	 */
	@RequiresPermissions("system:cgzxChkbillMesT:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(CgzxChkbillMesT cgzxChkbillMesT)
	{
		startPage();
        List<CgzxChkbillMesT> list = cgzxChkbillMesTService.selectCgzxChkbillMesTList(cgzxChkbillMesT);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出专检任务结果(城轨轴箱)列表
	 */
	@RequiresPermissions("system:cgzxChkbillMesT:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(CgzxChkbillMesT cgzxChkbillMesT)
    {
    	List<CgzxChkbillMesT> list = cgzxChkbillMesTService.selectCgzxChkbillMesTList(cgzxChkbillMesT);
        ExcelUtil<CgzxChkbillMesT> util = new ExcelUtil<CgzxChkbillMesT>(CgzxChkbillMesT.class);
        return util.exportExcel(list, "cgzxChkbillMesT");
    }
	
	/**
	 * 新增专检任务结果(城轨轴箱)
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存专检任务结果(城轨轴箱)
	 */
	@RequiresPermissions("system:cgzxChkbillMesT:add")
	@Log(title = "专检任务结果(城轨轴箱)", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(CgzxChkbillMesT cgzxChkbillMesT)
	{		
		return toAjax(cgzxChkbillMesTService.insertCgzxChkbillMesT(cgzxChkbillMesT));
	}

	/**
	 * 修改专检任务结果(城轨轴箱)
	 */
	@GetMapping("/edit/{gid}")
	public String edit(@PathVariable("gid") String gid, ModelMap mmap)
	{
		CgzxChkbillMesT cgzxChkbillMesT = cgzxChkbillMesTService.selectCgzxChkbillMesTById(gid);
		mmap.put("cgzxChkbillMesT", cgzxChkbillMesT);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存专检任务结果(城轨轴箱)
	 */
	@RequiresPermissions("system:cgzxChkbillMesT:edit")
	@Log(title = "专检任务结果(城轨轴箱)", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(CgzxChkbillMesT cgzxChkbillMesT)
	{		
		return toAjax(cgzxChkbillMesTService.updateCgzxChkbillMesT(cgzxChkbillMesT));
	}
	
	/**
	 * 删除专检任务结果(城轨轴箱)
	 */
	@RequiresPermissions("system:cgzxChkbillMesT:remove")
	@Log(title = "专检任务结果(城轨轴箱)", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(cgzxChkbillMesTService.deleteCgzxChkbillMesTByIds(ids));
	}
	
}
